package  cn.copera.dyy.common.utils.filter.builder;

public class EmptyField implements Field {
	private String name, value, relational, dataType, logical;

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public String getLogical() {
		return logical;
	}

	public void setLogical(String logical) {
		this.logical = logical;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRelational() {
		return relational;
	}

	public void setRelational(String relational) {
		this.relational = relational;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getSql() {
		if (name == null || relational == null)
			return null;

		StringBuffer sb = new StringBuffer();

		sb.append(' ').append(name).append(' ').append( BuildFilterBean.relationals.get(relational));

		if ("number".equalsIgnoreCase(dataType))
			sb.append(' ').append( value);
		else
			sb.append('\'').append(value).append('\'');

		return sb.toString();
	}
}
